package com.iqiao.platform.dao;

import com.iqiao.common.base.BaseDao;
import com.iqiao.platform.model.User;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by flt on 2017/11/9.
 */
@Repository
public class UserDao extends BaseDao<User, Long> {

    @Override
    public Class getEntityClass() {
        return this.getClass();
    }

    public User findByUsername(String username) {
        return this.getUnique("findByUsername", username);
    }

    public boolean existByUsername(String username) {
        Map<String, Object> params = new HashMap<>();
        params.put("username", username);
        return super.exist(params);
    }
}
